<div class="wrap">
	<h2>
		<?php echo $Title." &raquo; Edit";?>
	</h2>
	<form id="formData" method="post">
		<table class="form-table">
			<tbody>
				<tr>
					<th>
						<label for="is_public">
							Public
						</label>	
					</th>
					<td>
						<input type="radio" name="is_public" value="1" <?php echo ($dataResult->is_public == "1" ? 'checked="checked"':'');?>> Yes&nbsp;
						<input type="radio" name="is_public" value="0" <?php echo ($dataResult->is_public == "0" ? 'checked="checked"':'');?>> No&nbsp;
						<input type="radio" name="is_public" value="2" <?php echo ($dataResult->is_public == "2" ? 'checked="checked"':'');?>> Banned
					</td>
				</tr>				
				<tr>
					<th scope="row">
						<label for="group_id">
							Group Name
						</label>
					</th>
					<td>
						<select id="group_id" name="group_id">
							<?php foreach($dataUserGroup as $value):?>
							<option value="<?php echo $value->group_id;?>" <?php echo ($dataResult->group_id == $value->group_id ? 'selected="selected"':'');?>>
								<?php echo $value->group_name;?>
							</option>
							<?php endforeach;?>
						</select>
					</td>
				</tr>
				<tr>
					<th>
						<label for="user_name">
							Username
						</label>
						<span class="description">
							(required)
						</span>	
					</th>
					<td>
						<input type="text" class="regular-text" id="user_name" name="user_name" value="<?php echo $dataResult->username;?>" readonly="readonly">
					</td>
				</tr>
				<tr id="password">
					<th>
						<label for="pass1">
							New Password
						</label>
					</th>
					<td>
						<input value=" " class="hidden"><!-- #24364 workaround -->
						<input type="password" autocomplete="off" value="" size="16" class="regular-text" id="pass1" name="pass1"><br>
						<span class="description">
							If you would like to change the password type a new one. Otherwise leave this blank.
						</span>
					</td>
				</tr>
				<tr>
					<th scope="row">
						<label for="pass2">
							Repeat New Password
						</label>
					</th>
					<td>
						<input type="password" autocomplete="off" value="" size="16" class="regular-text" id="pass2" name="pass2" equalTo="#pass1"><br>
						<span class="description">
							Type your new password again.
						</span>
						<br>
						<div id="pass-strength-result" style="display: block;" class="">
							Strength indicator
						</div>
						<p class="description indicator-hint">
							Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).
						</p>
					</td>
				</tr>
				<tr>
					<th>
						<label for="first_name">
							First Name
						</label>
					</th>
					<td>
						<input type="text" class="regular-text" id="first_name" name="first_name" value="<?php echo $dataResult->first_name;?>">
					</td>
				</tr>
				<tr>
					<th>
						<label for="last_name">
							Last Name
						</label>
					</th>
					<td>
						<input type="text" class="regular-text" id="last_name" name="last_name" value="<?php echo $dataResult->last_name;?>">
					</td>
				</tr>				
				<tr>
					<th>
						<label for="nickname">
							Nickname
							<span class="description">
								(required)
							</span>
						</label>
					</th>
					<td>
						<input type="text" class="regular-text required" id="nickname" name="nickname" value="<?php echo $dataResult->nickname;?>">
					</td>
				</tr>
				<tr>
					<th>
						<label for="user_email">
							Email
						</label>
						<span class="description">
							(required)
						</span>	
					</th>
					<td>
						<input type="text" class="regular-text required email" id="user_email" name="user_email" value="<?php echo $dataResult->email;?>">
					</td>
				</tr>
				<tr>
					<th>
						<label for="telephone">
							Telephone
						</label>
					</th>
					<td>
						<input type="text" class="regular-text" id="telephone" name="telephone">
					</td>
				</tr>				
			</tbody>
		</table>
		<p class="submit">
			<input type="submit" value="Edit" class="button button-primary">
		</p>
	</form>
</div>

<script type="text/javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		$.validator.addMethod("email", function(value, element) {
			var returnVal = false;
			var corectEmail = $.validator.methods.email2.call(this, value, element);
			if(!corectEmail) return returnVal;
			$.ajax({
				type:"post",
				url: "../ajax_valid_email",
				data:({
					email:value,
					username:"<?php echo $dataResult->username;?>"
				}),
				async: false
			}).done(function(data){
				if(data == "valid"){
					returnVal = true;	
				}
			});
			if(!returnVal){
				if($(element).parent().find(".description").length){
					$(element).parent().find(".description").remove();
				}
				$('<span class="description form-invalid"> This Email already exists.</span>').insertAfter(element);
			}
			return returnVal;
		});
			
		$("#formData").validate({
			errorPlacement: function(error, element) {
				return true;
			},		
			highlight: function( element, errorClass, validClass ) {
				$(element).closest('tr').addClass('form-invalid');
			},
			unhighlight: function( element, errorClass, validClass ) {
				$(element).closest('tr').removeClass('form-invalid').find('.form-invalid').remove();
			},				
		});
	});	
})(jQuery);
</script>